using System;
using System.Net;


namespace Framework.Network
{
    public enum NetworkProtocol
    {
        TCP,
    }

    public abstract class BaseService : BaseEntity
    {
        public abstract BaseChannel GetChannel(int channelId);

        public abstract BaseChannel ConnectChannel(IPEndPoint ipEndPoint);

        public abstract BaseChannel ConnectChannel(string address);

        public abstract void Remove(int channelId);

        private Action<BaseChannel> m_AcceptCallBack;

        public event Action<BaseChannel> AcceptCallBack
        {
            add
            {
                this.m_AcceptCallBack += value;
            }
            remove
            {
                this.m_AcceptCallBack -= value;
            }
        }

        public void OnAccept(BaseChannel channel)
        {
            this.m_AcceptCallBack.Invoke(channel);
        }

    }
}